@extends("layouts.backend.webadmin")
@section('page-header')
    <h1>
        <small>falw\menu</small>
    </h1>
@endsection
@include('backend.flaw.msg')
<link rel="stylesheet" href="{{env('APP_ROOT')}}/assets/layui/css/layui.css">
<script src="{{env('APP_ROOT')}}/assets/layui/layui.js"></script>


@section('content')

    <!-- Main content -->
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-body">
                    <form method="POST"   lay-filter="boardFilter" action="{{ URL::route('admin.flaw.ensureForm') }}">

                        <div class="form-group">
                            <label for="vulsCategoryId">漏洞编号</label><br>
                            @foreach ($vuls as $lists)
                                <blockquote id="vulsCategoryId" class="layui-elem-quote layui-quote-nm">
                                    {{$lists->vuls_number}}
                                </blockquote>
                            @endforeach
                        </div>
                        @needsroles([2,3])
                        <div class="form-group">
                            <label for="vulsCategoryId">标题</label><br>
                            @foreach ($vuls as $lists)
                                <blockquote id="vulsCategoryId" class="layui-elem-quote layui-quote-nm">
                                    {{$lists->title}}
                                </blockquote>
                            @endforeach
                        </div>
                        @endauth
                        <div class="form-group">
                            <label for="vulsCategoryId">副标题</label><br>
                            @foreach ($vuls as $lists)
                                <blockquote id="vulsCategoryId" class="layui-elem-quote layui-quote-nm">
                                    {{$lists->description}}
                                </blockquote>
                            @endforeach
                        </div>
                        <div class="form-group">
                            <label for="vulsCategoryId">漏洞URL</label><br>
                            @foreach ($vuls as $lists)
                                <blockquote id="vulsCategoryId" class="layui-elem-quote layui-quote-nm">
                                    {{$lists->form_url}}
                                </blockquote>
                            @endforeach
                        </div>
                        <div class="form-group">
                            <label for="vulsCategoryId">URL参数</label><br>
                            @foreach ($vuls as $lists)
                                <blockquote id="vulsCategoryId" class="layui-elem-quote layui-quote-nm">
                                    {{$lists->url_parms}}
                                </blockquote>
                            @endforeach
                        </div>
                        <div class="form-group">
                            <label for="vulsCategoryId">Payload</label><br>
                            @foreach ($vuls as $lists)
                                <blockquote id="vulsCategoryId" class="layui-elem-quote layui-quote-nm">
                                    {{$lists->payload}}
                                </blockquote>
                            @endforeach
                        </div>
                        <div class="form-group">
                            <label for="vulsCategoryId">漏洞详情</label><br>
                            <blockquote class="layui-elem-quote layui-quote-nm" id="vulsCategoryId">
                                {!!$vuls[0]->content  !!}
                            </blockquote>
                        </div>
                        <div class="form-group">
                            <label for="vulsCategoryId">参考资料</label><br>
                            @foreach($vuls[0]->ref as $ref)
                                <div class="col-md-12">
                                    <a style="padding-left:15px;" target="_blank" href="{{route('knowledge.showpage',['id'=>$ref->id])}}">{{mb_substr($ref->title,0,50)}}</a>
                                </div>
                            @endforeach
                        </div>
                        <div class="row">
                            <div class="col-md-4">
                                <label for="level">漏洞评级</label><br>
                                <select style="color: red;" class="form-control" disabled lay-filter="level" id="level" name="level">
                                    <option value="">--请选择评级--</option>
                                    @if($level)
                                        @foreach ($level as $lists)
                                            <option @if($lists->id==$vuls[0]->level_id)  selected  @endif
                                            value="{{$lists->id}}">{{$lists->name}}</option>
                                        @endforeach
                                    @endif
                                </select>
                            </div>
                            <div class="col-md-4">
                                <div class="layui-form-item">
                                    <label>分派</label>
                                    <div>
                                        @if(!empty($list->name))
                                            <input type="text" id="credit" disabled  autocomplete="off" class="layui-input" value="{{$list->name}}">
                                        @endif
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label>描述</label>
                            <textarea id="desc" class="form-control" maxlength="255" required rows="3" placeholder="如确认漏洞，请说明计划修复时间；
如漏洞属于其他系统，请进行申诉。如果您知道漏洞所属系统及联系人，麻烦申诉时向我们提供这些信息，谢谢！"
                                      name="description"></textarea>
                        </div>
                        <div class="form-group">
                            {{csrf_field()}}
                            <input type="hidden" name="id" value="{{$id}}">
                            <button class="layui-btn" name="allocations" value="allocations" lay-submit
                                    lay-filter="formDemo">确认
                            </button>
                            <button type="submit" name="appeal" value="appeal" class="layui-btn layui-btn-primary">申诉
                            </button>
                        </div>
                        {{--<div class="form-group">
                            <label for="level">漏洞评级</label><br>
                            <select class="form-control" disabled lay-filter="level" id="level" name="level">
                                <option value="">--请选择评级--</option>
                                @if($level)
                                    @foreach ($level as $lists)
                                        <option @if($lists->id==$vuls[0]->level_id)  selected  @endif
                                        value="{{$lists->id}}">{{$lists->name}}</option>
                                    @endforeach
                                @endif
                            </select>
                        </div>--}}
                        @if($record)
                            <div class="form-group">
                                <label for="vulsCategoryId">修复过程</label>
                                <blockquote class="layui-elem-quote layui-quote-nm">
                                    <ul class="layui-timeline">

                                        @foreach($record as $records)
                                            <li class="layui-timeline-item">
                                                <i class="layui-icon layui-timeline-axis">&#xe63f;</i>
                                                <div class="layui-timeline-content layui-text">
                                                    <h3 class="layui-timeline-title">
                                                        @if($records->created_at)
                                                            {{$records->created_at}}
                                                        @endif
                                                    </h3>
                                                    <ul>
                                                        @if($records->vuls_status)
                                                            <li>
                                                                状态：{{$status[$records->vuls_status]['name']}}
                                                            </li>
                                                        @endif
                                                            @if($records->creatname)
                                                                <li>
                                                                    创建者：{{$records->creatname}}({{$records->creal_name}})                                                                  ({{$records->phone}})
                                                                </li>
                                                            @endif


                                                            @if($records->updatename)
                                                                <li>
                                                                    更新者：{{$records->updatename}}({{$records->ureal_name}})   ({{$records->phone}})
                                                                </li>
                                                            @endif
                                                            @if($records->reward)
                                                                <li>
                                                                    当前金币：{{$records->reward}}
                                                                </li>
                                                            @endif
                                                            @if($records->credit)
                                                                <li>
                                                                    当前积分：{{$records->credit}}
                                                                </li>
                                                            @endif
                                                        @if($records->content)
                                                            <li>
                                                                说明：{{$records->content}}
                                                            </li>
                                                        @endif
                                                    </ul>
                                                </div>
                                            </li>
                                        @endforeach

                                    </ul>
                                </blockquote>
                            </div>
                        @endif
                        {{--<div class="form-group">
                            <div class="layui-form-item">
                                <label>分派</label>
                                <div>
                                    @if(!empty($list->name))
                                    <input type="text" id="credit" disabled  autocomplete="off" class="layui-input" value="{{$list->name}}">
                                    @endif
                                </div>
                            </div>
                        </div>--}}
                        @if(!empty($vuls[0]->source))
                            @if($vuls[0]->source==1)
                            @else
                                <div class="form-group">
                                    <div class="layui-form-item">
                                        <label>积分</label>
                                        <div>
                                            <input type="number" id="credit"  disabled  autocomplete="off" class="layui-input" value="{{$vuls[0]->credit}}">
                                        </div>
                                    </div>
                                </div>
                            @endif
                        @endif


                    </form>
                        <input type="hidden" id="error" value="@foreach ($errors->all() as $error){{ $error }}@endforeach">
                        @if(count($errors->all()))
                            <script type="text/javascript">
                                var message=$("#error").val();
                                layui.use('layer', function(){
                                    var layer = layui.layer;
                                    layer.open({
                                        title: '错误提示'
                                        ,content: message
                                    });
                                });
                            </script>

                        @endif
                        <input type="hidden" id="errors" value="{{session('flow_error')}}">
                        @if(session('flow_error'))
                            <script type="text/javascript">
                                var message=$("#errors").val();
                                layui.use('layer', function(){
                                    var layer = layui.layer;
                                    layer.open({
                                        title: '错误提示'
                                        ,content: message
                                    });
                                });
                            </script>

                        @endif
                    </div>
                </div>
            </div>
        </div>
    </section>
@stop